<template>
  <Portlet title="订单信息" style="position:relative;">
    <el-form label-position="left" label-width="120px">
      <el-row>
        <el-col :lg="6" :md="12" >
          <el-form-item label="关联订单：">
            <span>{{chOrderService.orderNo}}</span>
          </el-form-item>
        </el-col>
        <el-col  :lg="6" :md="12">
          <el-form-item label="入库单号：">
            <span>{{chOrderService.inputWarehouseNo}}</span>
          </el-form-item>
        </el-col>
        <el-col  :lg="6" :md="12" >
          <el-form-item label="商家名称：">
            <span>{{chOrderService.cargoOwner}}</span>
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" >
          <el-form-item label="入库仓：">
            <span>{{chOrderService.warehouse}}</span>
          </el-form-item>
        </el-col>
        <!--入库单详情、入库库位分配详情、入库确认详情-->
        <el-col  :lg="6" :md="12">
          <el-form-item label="关联订单类型：">
            <span>{{chOrderService.orderType | filterDataBaseDictionary}}</span>
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12">
          <el-form-item label="存储类型：">
            <span>{{chOrderService.inputTypeCode | filterDataBaseDictionary}}</span>
          </el-form-item>
        </el-col>

        <!--入库单详情-->
        <el-col :lg="6" :md="12" v-if="routeName === 'warehousingOrderShow'">
          <el-form-item label="入库状态：">
            <span>{{chOrderService.orderState | filterDataBaseDictionary}}</span>
          </el-form-item>
        </el-col>

        <!--入库未分配 详情、-->
        <el-col :lg="6" :md="12" v-if="routeName === 'warehousingOrderShow' || ((routeName === 'warehouseAllocationShow' || routeName === 'warehouseAllocationCdShow') && state == 1)">
          <el-form-item label="到件时间：">
            <span>{{chOrderService.arriveTime | unixTimestampFilter('YYYY-MM-DD HH:mm')}}</span>
          </el-form-item>
        </el-col>
        <!--入库已分配 详情、入库未确认详情-->
        <el-col :lg="6" :md="12" v-if="(routeName === 'enterWarehouseConfirmShow' && state == 3) || ((routeName === 'warehouseAllocationShow' || routeName === 'warehouseAllocationCdShow') && state == 2)">
          <el-form-item label="分配人："> <span > {{chOrderService.distributePersonName}} </span> </el-form-item>
        </el-col>
        <!--入库已分配 详情、入库未确认详情-->
        <el-col :lg="6" :md="12" v-if="(routeName === 'enterWarehouseConfirmShow'  && state == 3)  || ((routeName === 'warehouseAllocationShow' || routeName === 'warehouseAllocationCdShow') && state == 2)">
          <el-form-item label="分配时间："><span > {{chOrderService.distributeTime | unixTimestampFilter('YYYY-MM-DD HH:mm')}} </span></el-form-item>
        </el-col>
        <!--入库已确认详情-->
        <el-col :lg="6" :md="12" v-if="(routeName === 'enterWarehouseConfirmShow' || routeName === 'warehouseRecordEnterShow') && state == 4">
          <el-form-item label="确认人："><span > {{chOrderService.checkPersonName}}</span></el-form-item>
        </el-col>
        <!--入库已确认详情-->
        <el-col :lg="6" :md="12" v-if="(routeName === 'enterWarehouseConfirmShow' || routeName === 'warehouseRecordEnterShow') && state == 4">
          <el-form-item label="确认时间："> <span > {{chOrderService.checktime | unixTimestampFilter('YYYY-MM-DD HH:mm')}} </span></el-form-item>
        </el-col>
        <!--入库未确认、已确认详情-->
        <el-col :lg="6" :md="12" v-if="(routeName === 'enterWarehouseConfirmShow' || routeName === 'warehouseRecordEnterShow')">
          <el-form-item label="拣货员："> <span > {{chOrderService.sortingName}} </span></el-form-item>
        </el-col>

        <!--&lt;!&ndash;入库记录详情：&ndash;&gt;-->
        <!--<el-col :lg="6" :md="12">-->
        <!--<el-form-item label="总包件："> <span> 暂无 </span> </el-form-item>-->
        <!--</el-col>-->
        <!--<el-col :lg="6" :md="12">-->
        <!--<el-form-item label="总体积："> <span> 暂无 </span> </el-form-item>-->
        <!--</el-col>-->
        <!--<el-col :lg="6" :md="12">-->
        <!--<el-form-item label="总重量："> <span> 暂无 </span> </el-form-item>-->
        <!--</el-col>-->
        <!--<el-col :lg="6" :md="12">-->
        <!--<el-form-item label="操作人："> <span> 暂无 </span> </el-form-item>-->
        <!--</el-col>-->
        <!--<el-col :lg="6" :md="12">-->
        <!--<el-form-item label="入库时间："> <span> 暂无 </span> </el-form-item>-->
        <!--</el-col>-->
      </el-row>
    </el-form>
    <el-button class="pull-right" type="text" @click="print" style="position:absolute;top:8px;right:10px;" v-if="(routeName === 'warehouseAllocationShow' || routeName === 'warehouseAllocationCdShow') && state == 2">打印入库拣货单</el-button>
    <PrintModal ref="PrintModal" :sortingId="id"></PrintModal>
  </Portlet>
</template>
<script>
// import {dotData} from '@/utils'
import {filterDataBaseDictionary, unixTimestampFilter} from '@/filters'
import PrintModal from '@/views/oms/enterWarehouse/warehousePicklist/PrintModal'
export default {
  components: {
    PrintModal
  },
  props: {
    chOrderService: {
      type: Object,
      default() {
        return {}
      }
    },
    routeName: {
      type: String,
      required: true
    },
    id: {
      type: String,
      default: ''
    },
    state: {
      type: [String, Number],
      default: ''
    }
  },
  data() {
    return {
      // model: {}
    }
  },
  methods: {
    unixTimestampFilter,
    filterDataBaseDictionary,
    toEdit() {
      if (this.id) {
        this.$router.push({path: '/ss-oms/enterWarehouse/warehousing-order/edit/' + this.id})
      } else {
        alert('订单号未取得')
      }
    },
    print() {
      this.$refs.PrintModal.show()
    }
  }
}
</script>
